<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Protocols  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset='utf-8'>
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a name="//apple_ref/swift/Section/Protocols" class="dashAnchor"></a>
    <a title="Protocols  Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="index.html">Bluejay Docs</a> (100% documented)</p>
        <p class="header-right"><a href="https://github.com/steamclock/bluejay"><img src="img/gh.png"/>View on GitHub</a></p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="index.html">Bluejay Reference</a>
        <img id="carat" src="img/carat.png" />
        Protocols  Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Classes/Bluejay.html">Bluejay</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/SynchronizedPeripheral.html">SynchronizedPeripheral</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Enums.html">Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Enums/AutoReconnectMode.html">AutoReconnectMode</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/BackgroundRestoreCompletion.html">BackgroundRestoreCompletion</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/BackgroundRestoreMode.html">BackgroundRestoreMode</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/BluejayError.html">BluejayError</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/ConnectionResult.html">ConnectionResult</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/DisconnectionResult.html">DisconnectionResult</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/ListenAction.html">ListenAction</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/ListenRestoreAction.html">ListenRestoreAction</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/MultipleListenOption.html">MultipleListenOption</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/ReadResult.html">ReadResult</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/RunResult.html">RunResult</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/ScanAction.html">ScanAction</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/StartMode.html">StartMode</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Timeout.html">Timeout</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/WriteResult.html">WriteResult</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Extensions/BinaryInteger.html">BinaryInteger</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/CBManagerState.html">CBManagerState</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/CBPeripheral.html">CBPeripheral</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/CBPeripheralState.html">CBPeripheralState</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/CBService.html">CBService</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/Data.html">Data</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/Peripheral.html">Peripheral</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/String.html">String</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Protocols/BackgroundRestorer.html">BackgroundRestorer</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/ConnectionObserver.html">ConnectionObserver</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/DisconnectHandler.html">DisconnectHandler</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/ListenRestorer.html">ListenRestorer</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/LogObserver.html">LogObserver</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/RSSIObserver.html">RSSIObserver</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/Receivable.html">Receivable</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/Sendable.html">Sendable</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/ServiceObserver.html">ServiceObserver</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Structs/BackgroundRestoreConfig.html">BackgroundRestoreConfig</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/CharacteristicIdentifier.html">CharacteristicIdentifier</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/DataPadding.html">DataPadding</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/PeripheralIdentifier.html">PeripheralIdentifier</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/ScanDiscovery.html">ScanDiscovery</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/ServiceIdentifier.html">ServiceIdentifier</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/StartOptions.html">StartOptions</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/WarningOptions.html">WarningOptions</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Typealiases.html">Type Aliases</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:7Bluejay13LaunchOptionsa">LaunchOptions</a>
              </li>
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:7Bluejay14ListenCallbacka">ListenCallback</a>
              </li>
              <li class="nav-group-task">
                <a href="Typealiases.html#/s:7Bluejay17RestoreIdentifiera">RestoreIdentifier</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>Protocols</h1>
            <p>The following protocols are available globally.</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay18BackgroundRestorerP"></a>
                    <a name="//apple_ref/swift/Protocol/BackgroundRestorer" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay18BackgroundRestorerP">BackgroundRestorer</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocols for handling the results of a background restoration.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    The delegate must be an <code>UIApplicationDelegate</code> in order to properly support background restoration during <code>didFinishLaunchingWithOptions</code>.

</div>

                        <a href="Protocols/BackgroundRestorer.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">BackgroundRestorer</span> <span class="p">:</span> <span class="kt">UIApplicationDelegate</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay18ConnectionObserverP"></a>
                    <a name="//apple_ref/swift/Protocol/ConnectionObserver" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay18ConnectionObserverP">ConnectionObserver</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A protocol allowing conforming objects registered to Bluejay to optionally respond to Bluetooth connection events.</p>
<div class="aside aside-attention">
    <p class="aside-title">Attention</p>
    <p>Attention
On initial subscription to Bluetooth events, <code>bluetoothAvailable(_ available: Bool)</code> will always be called immediately with whatever the current state is, and <code>connected(to peripheral: PeripheralIdentifier)</code> will also be called immediately if a device is already connected.</p>

</div>
<div class="aside aside-note">
    <p class="aside-title">Note</p>
    <p>Note
Available callbacks:</p>

</div>
<li><p><code>func bluetoothAvailable(_ available: Bool)</code></p></li>
<li><p><code>func connected(to peripheral: PeripheralIdentifier)</code></p></li>
<li><p><code>func disconnected(from peripheral: PeripheralIdentifier)</code></p></li>

                        <a href="Protocols/ConnectionObserver.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ConnectionObserver</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay17DisconnectHandlerP"></a>
                    <a name="//apple_ref/swift/Protocol/DisconnectHandler" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay17DisconnectHandlerP">DisconnectHandler</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A protocol allowing a single delegate registered to Bluejay to have a final say at the end of a disconnection, as well as evaluate and control the auto-reconnect behaviour.</p>
<div class="aside aside-attention">
    <p class="aside-title">Attention</p>
    Be careful with how you organize app and Bluejay logic inside your connect, explicit disconnect, the disconnect handler callbacks. It may be easy to create redundant or conflicting code. As a rule of thumb, we recommend putting light weight and repeatable logic, such as UI updates, inside your connect and disconnect callbacks. And for more major operations such as restarting any Bluetooth tasks, use the disconnect handler.

</div>

                        <a href="Protocols/DisconnectHandler.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DisconnectHandler</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay14ListenRestorerP"></a>
                    <a name="//apple_ref/swift/Protocol/ListenRestorer" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay14ListenRestorerP">ListenRestorer</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol for handling a listen event that does not have a callback due to background restoration.</p>

                        <a href="Protocols/ListenRestorer.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ListenRestorer</span> <span class="p">:</span> <span class="kt">UIApplicationDelegate</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay11LogObserverP"></a>
                    <a name="//apple_ref/swift/Protocol/LogObserver" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay11LogObserverP">LogObserver</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A protocol allowing conforming objects to monitor log file changes.</p>

                        <a href="Protocols/LogObserver.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LogObserver</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay12RSSIObserverP"></a>
                    <a name="//apple_ref/swift/Protocol/RSSIObserver" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay12RSSIObserverP">RSSIObserver</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A protocol allowing conforming objects to monitor the RSSI changes of a connected peripheral.</p>

                        <a href="Protocols/RSSIObserver.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">RSSIObserver</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay10ReceivableP"></a>
                    <a name="//apple_ref/swift/Protocol/Receivable" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay10ReceivableP">Receivable</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol to indicate that a type can be received from the Bluetooth connection.</p>

                        <a href="Protocols/Receivable.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Receivable</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay8SendableP"></a>
                    <a name="//apple_ref/swift/Protocol/Sendable" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay8SendableP">Sendable</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Protocol to indicate that a type can be sent via the Bluetooth connection.</p>

                        <a href="Protocols/Sendable.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Sendable</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:7Bluejay15ServiceObserverP"></a>
                    <a name="//apple_ref/swift/Protocol/ServiceObserver" class="dashAnchor"></a>
                    <a class="token" href="#/s:7Bluejay15ServiceObserverP">ServiceObserver</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A protocol allowing conforming objects to monitor the services changes of a connected peripheral.</p>

                        <a href="Protocols/ServiceObserver.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">ServiceObserver</span> <span class="p">:</span> <span class="kt">AnyObject</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>Copyright © 2017 Steamclock Software. All rights reserved.</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.5</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
